/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.hazardsource.mapper;

import com.koron.hazardsource.domain.CheckListItem;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.koron.ebs.mybatis.EnvSource;

import java.util.List;


public interface CheckListItemMapper {
    /**
     * 根据主键查询检查项详情
     * @param tableName
     * @param id
     * @return
     */
    CheckListItem queryOne(@Param("tableName") String tableName,@Param("id") String id);

    /**
     * 根据标准检查表id查询检查项列表
     * @param tableName
     * @param checklistEntryId
     * @param start
     * @param rows
     * @return
     */
    List<CheckListItem> queryItemsInByEntryId(@Param("tableName") String tableName,@Param("checklistEntryId") String checklistEntryId,
                                          @Param("start") Integer start,@Param("rows") Integer rows);

    /**
     * 新增检查项
     * @param bean
     * @return
     */
    Integer insert(@Param("tableName") String tableName,@Param("bean") CheckListItem bean);

    /**
     * 批量新增检查项
     * @param tableName
     * @param itemList
     * @return
     */
    Integer batchInsert(@Param("tableName") String tableName,@Param("itemList") List<CheckListItem> itemList);

    /**
     * 修改检查项
     * @param bean
     * @return
     */
    Integer update(@Param("tableName") String tableName,@Param("bean") CheckListItem bean);

    /**
     * 批量修改检查项
     * @param tableName
     * @param checkItemList
     * @return
     */
    Integer batchUpdate(@Param("tableName") String tableName,@Param("checkItemList") List<CheckListItem> checkItemList);
    
    /**
     * 按检查表主键删除检查项
     * @param entryId
     * @return
     */
    Integer deleteByEntryId(@Param("tableName") String tableName,@Param("entryId") String entryId);

    @Delete("delete from checklist_item_history where checklist_entry_id =#{id}")
    Integer deleteDraft(@Param("id") String id);


}

